<?php 
/*$str = 'hi, this is his history';
$patt = '/hi/';
preg_match_all($patt,$str,$res);
print_r($res);
*/

// $str = 'hi this is some history book';
// $patt = '/\bhi\b/';
// preg_match_all($patt,$str,$res);
// print_r($res);

// $arr = array('13800138000','13487651687','434456','45454353434543');
// $patt = '/^[01235689]{11}$/';
// foreach($arr as $v){
// 	preg_match_all($patt,$v,$res);
// 	print_r($res);
// }

// $str = 'o2o, b2b, hello,word, that';
// $patt = '/\b[a-zA-Z]+\b/';
// preg_match_all($patt,$str,$res);
// print_r($res);

// $str = 'tommorw is another day,o2o ,you dont bird me i dont bird you';
// $patt = '/\W{1,}/';
// print_r(preg_split($patt,$str));

// $str = 'a    b   hello     world';
// $patt = '/\s{1,}/';
// echo preg_replace($patt,'',$str);

// $str = 'longren lao wang meng ge bi';
// $patt = '/\b[a-zA-Z]{4}\b/';
// $patt = '/\b[a-zA-Z]{3,5}\b/';
// $patt = '/\b[a-zA-Z]{5,}\b/';
// preg_match_all($patt,$str,$res);
// print_r($res);

// $str = 'gooooood,gooood,gooooooooooood';
// $patt = '/go+d/';
// print_r(preg_replace($patt,'god',$str));

// $str = 'hello o2o 2b9 250';
// $patt = '/\b[a-zA-z]+\b|\b[0-9]+\b/';
// preg_match_all($patt,$str,$res);
// print_r($res);

// $str = 'ipad iphone imac ipod iamsorry';
// $patt = '/i(pad|phone|mac|pod)/';
// preg_match_all($patt,$str,$res);
// print_r($res);

// $str = 'ksda good gooooood good kl s ja dfs dk';
// $patt = '/g.+d/';
// preg_match_all($patt,$str,$res);
// print_r($res);
// $patt = '/g.+?d/';
// preg_match_all($patt,$str,$res);
// print_r($res);

// $str = '王先森,要卖肾,联系手机号:18610886812,备用电话:15615614187,email:laowang@qq.com,诚信急卖,身份证号:15212343822830022';
// $patt = '/\b1[s458]\d{9}\b/';
// preg_match_all($patt,$str,$res);
// print_r($res);

// $str = 'txt hello,high,bom,num';
// //$patt = '/t\w+t/';
// $patt = '/\b([a-z])\w+\1\b/';
// preg_match_all($patt,$str,$res);
// print_r($res);

// $str = '13800138000,13426060134';
// $patt = '/(\d{3})\d{4}(\d{4})/';
// echo preg_replace($patt,'\1****\2',$str);

/*$str = 'hello WORLD ChINa';
// $patt = '/\b[a-z]+\b/';
$patt = '/\b[a-z]+\b/i';
preg_match_all($patt,$str,$res);
print_r($res);*/

// $str = "abc haha 
// abc dgh";
// $patt = '/.+/s';
// preg_match_all($patt,$str,$res);
// print_r($res);

// $str = 'bob李';
// $patt = '/^[\x{4e00}-\x{9fa5}]+$/u';
// echo preg_match($patt,$str)?'国货':'杂货';
/*$str = 'hello , when i am working ,don not coming';
// $patt = '/\b\w+(?=ing\b)/';
// preg_match_all($patt,$str,$res);
// print_r($res);
$patt = '/\b\w+(?!ing)\w{3}\b/';
preg_match_all($patt,$str,$res);
print_r($res);
*/

$str = 'luck ,unlucky, state, unhappy';
// $patt = '/(?<=\bun)\w+\b/';
// preg_match_all($patt,$str,$res);
// print_r($res);
$patt = '/\b\w{2}(?<!un)\w*\b/';
preg_match_all($patt,$str,$res);
print_r($res);
